﻿<%@ Page Language="C#" Culture="es-PE" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="_Default" %>


<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>OSHARE SPA</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadButton ID="RadButton1" runat="server" onclick="RadButton1_Click" 
            Text="carga">
        </telerik:RadButton>
        <div>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
			function ShowEditForm(id, rowIndex)
			{
                var grid = $find("<%= RadGrid1.ClientID %>");
                
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();                
                grid.get_masterTableView().selectItem(rowControl, true);
                		
				window.radopen("EditFormCS.aspx?EmployeeID=" + id, "UserListDialog");
				return false; 
			}
            function ShowInsertForm()
            {
               window.radopen("EditFormCS.aspx", "UserListDialog");
               return false;
            }
			function refreshGrid(arg)
			{
			    if(!arg)
			    {
			        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");			        
				}
				else
				{
			        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");			        
				}
			}
            </script>
        </telerik:RadCodeBlock> 
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>      
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>                                  
                </AjaxSettings>
            </telerik:RadAjaxManager>
            
            <telerik:RadGrid 
                OnItemCreated="RadGrid1_ItemCreated" 
                ID="RadGrid1" 
                runat="server" 
                Skin="Black" 
                Width="100%" Culture="Spanish (Peru)" 
                AllowFilteringByColumn="True" AllowSorting="True" GridLines="None" 
                ShowGroupPanel="True" AutoGenerateColumns="False" PageSize="30">
               <HeaderContextMenu EnableImageSprites="True"></HeaderContextMenu>

                <PagerStyle Mode="NumericPages" />
                <MasterTableView 
                    Width="100%"
                    CommandItemDisplay="Top" 
                    PageSize="5">
                    <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="column">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <CommandItemTemplate>
                    <table width="75%">
                        <tr>
                            <td> <a href="#"  onclick="return ShowInsertForm();">Nuevo Producto</a> </td>
                            <td> <a href="#" onclick="return ShowInsertForm();">Editar Seleccionado</a></td>
                            
<%--                            editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"], e.Item.ItemIndex);
--%>
                            <td> <a href="#" onclick="return ShowEditForm(e.Item.ItemIndex));">Eliminar Seleccinado</a> </td>
                            <td>  </td>
                        </tr>
                    </table>
                    </CommandItemTemplate>
                </MasterTableView>
                <ClientSettings AllowDragToGroup="True">
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
            </telerik:RadGrid>
            
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista">
                <Windows>
                    <telerik:RadWindow Skin="Vista"  ID="UserListDialog" runat="server" Title="User List Dialog" Height="400px"
                        Width="300px" Left="150px" ReloadOnShow="true" Modal="true"  />
                </Windows>
            </telerik:RadWindowManager>
            
        </div>     
    </form>
</body>
</html>
